package cn.hl.hm.entity;

import java.math.BigDecimal;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

public class OrderPO  extends BasePO{
	
	
	public static OrderPO calculateOrder(List<RoadFee> list){
		OrderPO po = new OrderPO();
		
		if(list == null){
			return po;
		}
		
		 int totalOrderNum  = 0;
		
		 int payOrderNum= 0;
		
		 int unpayOrderNum= 0;
		
		 BigDecimal totalOrderAmount=new BigDecimal(0);
		
		 BigDecimal payOrderAmount=new BigDecimal(0);

		 BigDecimal unpayOrderAmount=new BigDecimal(0);
		
		 int balancePayOrderNum= 0;
		
		 BigDecimal balancePayOrderAmount=new BigDecimal(0);
		
		 int wxPayOrderNum= 0;
		
		 BigDecimal wxPayOrderAmount=new BigDecimal(0);
		
		 int zfbPayOrderNum= 0;
		
		 BigDecimal zfbPayOrderAmount=new BigDecimal(0);
		
		 int cashPayOrderNum= 0;
		
		 BigDecimal cashPayOrderAmount =new BigDecimal(0);

		 int FreeOrderNum= 0;

		 int closeOrderNum= 0;

		 BigDecimal closeOrderAmount=new BigDecimal(0);

		for (RoadFee roadFee : list) {
			totalOrderNum++;
			String orderStatus = roadFee.getOrderStatus();
			String payType = roadFee.getPayType();
			BigDecimal totalPrice = roadFee.getTotalPrice();
			
			if(orderStatus.equals("1")){
				unpayOrderNum++;
				unpayOrderAmount = unpayOrderAmount.add(totalPrice);

			}else if(orderStatus.equals("2")){
				payOrderNum++;
				payOrderAmount = payOrderAmount.add(totalPrice);
				if(StringUtils.isBlank(payType)){
					FreeOrderNum++;
				}else {
					if(payType.equals("21")||payType.equals("22")){
						wxPayOrderNum++;
						wxPayOrderAmount  = wxPayOrderAmount.add(totalPrice);
					}else if (payType.equals("23")||payType.equals("24")) {
						zfbPayOrderNum++;
						zfbPayOrderAmount  = zfbPayOrderAmount.add(totalPrice);
					}else if (payType.equals("25")) {
						balancePayOrderNum++;
						balancePayOrderAmount  = balancePayOrderAmount.add(totalPrice);
					}else if (payType.equals("26")) {
						cashPayOrderNum++;
						cashPayOrderAmount  = cashPayOrderAmount.add(totalPrice);
					}
				}
			}else{
				closeOrderNum++;
				closeOrderAmount = closeOrderAmount.add(totalPrice);
			}
			
			
			totalOrderAmount = totalOrderAmount.add(totalPrice);
		}
		
		
		po.setBalancePayOrderAmount(balancePayOrderAmount);
		po.setBalancePayOrderNum(balancePayOrderNum);
		po.setCashPayOrderAmount(cashPayOrderAmount);
		po.setCashPayOrderNum(cashPayOrderNum);
		po.setFreeOrderNum(FreeOrderNum);
		po.setPayOrderAmount(payOrderAmount);
		po.setPayOrderNum(payOrderNum);
		po.setTotalOrderAmount(totalOrderAmount);
		po.setTotalOrderNum(totalOrderNum);
		po.setUnpayOrderAmount(unpayOrderAmount);
		po.setUnpayOrderNum(unpayOrderNum);
		po.setWxPayOrderAmount(wxPayOrderAmount);
		po.setWxPayOrderNum(wxPayOrderNum);
		po.setZfbPayOrderAmount(zfbPayOrderAmount);
		po.setZfbPayOrderNum(zfbPayOrderNum);
		return po;
		
		
	}
	
	private int totalOrderNum ;
	
	private int payOrderNum;
	
	private int unpayOrderNum;
	
	private BigDecimal totalOrderAmount;
	
	private BigDecimal payOrderAmount;

	private BigDecimal unpayOrderAmount;
	
	private int balancePayOrderNum;
	
	private BigDecimal balancePayOrderAmount;
	
	private int wxPayOrderNum;
	
	private BigDecimal wxPayOrderAmount;
	
	private int zfbPayOrderNum;
	
	private BigDecimal zfbPayOrderAmount;
	
	private int cashPayOrderNum;
	
	private int FreeOrderNum;
	
	private BigDecimal cashPayOrderAmount;

	
	
	public int getFreeOrderNum() {
		return FreeOrderNum;
	}

	public void setFreeOrderNum(int freeOrderNum) {
		FreeOrderNum = freeOrderNum;
	}

	public int getTotalOrderNum() {
		return totalOrderNum;
	}

	public void setTotalOrderNum(int totalOrderNum) {
		this.totalOrderNum = totalOrderNum;
	}

	public int getPayOrderNum() {
		return payOrderNum;
	}

	public void setPayOrderNum(int payOrderNum) {
		this.payOrderNum = payOrderNum;
	}

	public int getUnpayOrderNum() {
		return unpayOrderNum;
	}

	public void setUnpayOrderNum(int unpayOrderNum) {
		this.unpayOrderNum = unpayOrderNum;
	}

	public BigDecimal getTotalOrderAmount() {
		return totalOrderAmount;
	}

	public void setTotalOrderAmount(BigDecimal totalOrderAmount) {
		this.totalOrderAmount = totalOrderAmount;
	}

	public BigDecimal getPayOrderAmount() {
		return payOrderAmount;
	}

	public void setPayOrderAmount(BigDecimal payOrderAmount) {
		this.payOrderAmount = payOrderAmount;
	}

	public BigDecimal getUnpayOrderAmount() {
		return unpayOrderAmount;
	}

	public void setUnpayOrderAmount(BigDecimal unpayOrderAmount) {
		this.unpayOrderAmount = unpayOrderAmount;
	}

	public int getBalancePayOrderNum() {
		return balancePayOrderNum;
	}

	public void setBalancePayOrderNum(int balancePayOrderNum) {
		this.balancePayOrderNum = balancePayOrderNum;
	}

	public BigDecimal getBalancePayOrderAmount() {
		return balancePayOrderAmount;
	}

	public void setBalancePayOrderAmount(BigDecimal balancePayOrderAmount) {
		this.balancePayOrderAmount = balancePayOrderAmount;
	}

	public int getWxPayOrderNum() {
		return wxPayOrderNum;
	}

	public void setWxPayOrderNum(int wxPayOrderNum) {
		this.wxPayOrderNum = wxPayOrderNum;
	}

	public BigDecimal getWxPayOrderAmount() {
		return wxPayOrderAmount;
	}

	public void setWxPayOrderAmount(BigDecimal wxPayOrderAmount) {
		this.wxPayOrderAmount = wxPayOrderAmount;
	}

	public int getZfbPayOrderNum() {
		return zfbPayOrderNum;
	}

	public void setZfbPayOrderNum(int zfbPayOrderNum) {
		this.zfbPayOrderNum = zfbPayOrderNum;
	}

	public BigDecimal getZfbPayOrderAmount() {
		return zfbPayOrderAmount;
	}

	public void setZfbPayOrderAmount(BigDecimal zfbPayOrderAmount) {
		this.zfbPayOrderAmount = zfbPayOrderAmount;
	}

	public int getCashPayOrderNum() {
		return cashPayOrderNum;
	}

	public void setCashPayOrderNum(int cashPayOrderNum) {
		this.cashPayOrderNum = cashPayOrderNum;
	}

	public BigDecimal getCashPayOrderAmount() {
		return cashPayOrderAmount;
	}

	public void setCashPayOrderAmount(BigDecimal cashPayOrderAmount) {
		this.cashPayOrderAmount = cashPayOrderAmount;
	}
	
	
	
}